package com.ftg.learn.chapter12.isa.animals;

import com.ftg.learn.chapter11.Place;

import java.io.DataOutput;

/**
 * jdk1.6
 * @author kangjx
 * @createTime 2022/8/3
 */
public class Play {

    public static void main(String[] args) {
        //叫做 多态
        //1 ： 子类 : 子类重写父类方法 （面向父类编程）
        //2 :  接口与实现类  实现类必须重写接口里面的所有public abstract (面向接口编程)
        Animal a = new Animal();
        a.eat();

        Animal a1 = new Dog();
        a1.eat();

        Animal a2 = new Wolf();
        a2.eat();

        Play p = new Play();
        p.a1(new Dog());
        p.a1(new Wolf());

    }

    public void a1(Animal a){
        a.eat();
    }

}
